Skip to content

aggregator: read AA configs/CAI from canonical measurement_events (retire benchmark_results) — #4401 tranche 2 - #8681

Merged
dezren39 merged 1 commit into
mainfrom
queue/14717-4401-aggregator-canonical
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/14717-4401-aggregator-canonical

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes the last open acceptance item of #4401 (tranche 2, task 14717).

What changes

  • pm-stack/aggregator/src/aa-batch-sql.ts: the AA payload's configs and cai sections no longer read the frozen ainventory.benchmark_results table. They read the canonical ainventory.measurement_events store, scoped to the latest workbook-import ingest batch (the events' equivalent of the latest sheet import batch), with speedTps projected from output_tps. The two sections ignore the sheet batch expression — canonical events carry no sheet import_batch identity — documented in the code comment.
  • Filters reproduce the retired table's latest-batch rows exactly: configs keep benchmark_version is null (the version-less AA scrape set, 35 rows); cai keeps rows whose raw carries benchmark_version (the workbook-import CAI shape the query projects, 27 rows).
  • Comment references in aa.ts, model.ts, and scripts/collect-fleet-feed.ts updated from benchmark_results to measurement_events.

Verification (live, before the drop)

  • Full-row EXCEPT comparison, old table (latest sheet batch) vs new query scope: configs 35/35, cai 27/27, zero differences in either direction.
  • Consumer audit: repo-wide grep — the aggregator was the only live code reader of benchmark_results; no Supabase views, functions, or matviews reference it; named consumers (quota gatherer, coding-plan-watch, pool-intelligence) have no references.
  • Tests: bun test test/aa-batches.test.ts test/aa-explorer-computations.test.ts test/aa-gate-*.test.ts — 46 pass, 0 fail. (test/aa.test.ts fails pre-existing in this environment on clean main too: live-server port / missing-package environment issues, unrelated.)

Database step (executed with this PR, recorded on #4401)

  • ainventory.benchmark_results (1,141 rows, frozen at the 2026-10-26 import) dropped after the parity verification above; its content is fully represented in measurement_events for every row the aggregator ever read.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…tire benchmark_results (code#4401 tranche 2)
@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 13:19
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b266b9a7-de00-42d7-8e83-8b42f6306fe4
Commits

Reviewing files that changed from the base of the PR and between fae6444 and f4ed342.

Files selected for processing: 4

  • pm-stack/aggregator/scripts/collect-fleet-feed.ts
  • pm-stack/aggregator/src/aa-batch-sql.ts
  • pm-stack/aggregator/src/aa.ts
  • pm-stack/aggregator/src/model.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T13:22:07.772111Z f4ed342 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 0566f38 into main Nov 11, 2026
1 of 10 checks passed
@dezren39
dezren39 deleted the queue/14717-4401-aggregator-canonical branch November 11, 2026 13:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4ed342027

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +608 to +609
where br.ingest_batch_id = (select ingest_batch_id from ainventory.measurement_events
where source_kind = 'workbook-import' order by ingested_at desc limit 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the selected batch for configs and coding-agent results

When a historical dataset is fetched or its cache is rebuilt, these predicates select the latest canonical ingest rather than the requested batch. collectAaSection still calls fetchAaPayload(row.importBatch) for historical entries, so the resulting payload combines historical rankings and timings with latest configs and CAI observations, then caches that mixture under the historical UUID. This contradicts the dataset selector's explicit promise in render.ts that older versions show that import's coding-agent rows and snapshot figures. Preserve a mapping to the selected import or reconstruct these sections from its retained snapshot data; latest-batch parity alone does not preserve historical behavior. The same issue applies to the cai predicate below.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant